home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / RZToDoList / Source / lock_file.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  870 b   |  30 lines

  1. /* 
  2.  * lock_file - functions for file locking
  3.  *
  4.  * You may freely copy, distribute and reuse the code in this example.
  5.  * This code is provided AS IS without warranty of any kind, expressed 
  6.  * or implied, as to its fitness for any particular use.
  7.  *
  8.  * Copyright 1995 Ralph Zazula (zazula@next.com).  All Rights Reserved.
  9.  *
  10.  */
  11.  
  12. #define LOCK_SUCCESS 0
  13. #define LOCK_EXIST -1
  14. #define LOCK_NOCREATE -2
  15.  
  16. int lock_file(char *filename);
  17. /*
  18.  * Drops a lock file "filename.lock" for "filename".  Returns:
  19.  *     LOCK_SUCCESS    (0)    success
  20.  *     LOCK_EXIST        (-1)    lock file already exists
  21.  *     LOCK_NOCREATE    (-2)    couldn't create lock file
  22.  */
  23.  
  24. int unlock_file(char *filename);
  25. /*
  26.  * removes the lock file "filename.lock" for "filename".
  27.  * Returns LOCK_SUCCESS on success and a negative error code on failure.
  28.  * The error code is that which resulted from the attempted unlink().
  29.  */
  30.